/*
 * @Author: wang cong wangc9832@163.com
 * @Date: 2023-06-14 11:11:31
 * @LastEditors: wang cong wangc9832@163.com
 * @LastEditTime: 2023-07-20 14:36:45
 * @FilePath: /ams-front/src/api/finance/amsReceiptDetailManage.ts
 * @Description:
 *
 * Copyright (c) 2023 by ${git_name_email}, All Rights Reserved.
 */
import { BasicFetchResult } from '../model/baseModel';
import { defHttp } from '@/utils/http/axios';
import { downloadBlob } from '@/utils/file/download';
const api = '/amsReceiptDetail';
// 查询预收款转出明细
export const selectAdvanceTransferOut = (id?: any) =>
  defHttp.get<BasicFetchResult<any>>({
    url: api + '/selectAdvanceTransferOut/' + id,
  });

// 查询可转出金额
export const transferableAmount = (id?: any) =>
  defHttp.get<BasicFetchResult<any>>({
    url: api + '/transferableAmount/' + id,
  });
// 查询预收款明细
export const selectAdvanceDetails = (id?: any) =>
  defHttp.get<BasicFetchResult<any>>({
    url: api + '/selectAdvanceDetails/' + id,
  });
// 导出收款明细
export const exp = (params?: any) => {
  return new Promise<void>((resolve, reject) => {
    defHttp
      .get(
        { responseType: 'blob', url: api + '/export', params },
        { isReturnNativeResponse: true }
      )
      .then((res) => {
        downloadBlob(res);
        resolve();
      })
      .catch(() => {
        reject();
      });
  });
};
